Data Folder

The dataset is made up of images from three grades of PACS, in decreasing order of risk of PACG:

Dataset is organised as such:

FOLDER NAME: "Data"

images_original contains the original RGB images obtained from the Raspberry Pi. images contains the pre-processed images into grayscale which will be used for the training and testing of the model. labels contains the segmentation PNG files from AVIZO.

Data pre-processing

All images must first be converted from RGB to grayscale. These images will be stored in the "images" folder in each grade folder.

Load data

Allocate pre-processed images from "images" and target from "labels" into train and test set.

In this code, the model is only trained on G3 images. G1 images are used as out-of-sample test data.

Visualize function

Takes in images as arrays and prints them using Matplotlib.

Dataloader

Writing helper class for data extraction, tranformation and preprocessing
https://pytorch.org/docs/stable/data

Augmentations

Data augmentation is a powerful technique to increase the amount of your data and prevent model overfitting.
If you not familiar with such trick read some of these articles:

Since our dataset is very small we will apply a large number of different augmentations:

All this transforms can be easily applied with Albumentations - fast augmentation library. For detailed explanation of image transformations you can look at kaggle salt segmentation exmaple provided by Albumentations authors.

image.png https://www.mdpi.com/information/information-11-00125/article_deploy/html/images/information-11-00125-g001.png

Create model and train

Test best saved model on G3 test data

Model is tested on the pre-allocated test data (G3).

Visualize testing predictions

All testing predictions will be saved into a folder called "results".

Finding colour ratio

This will give some insight into the ratio of the shadow to iris.

RGB values:

*Numbers with very similar values can be counted towards the colour category

Out-of-sample G1 test data

There are currently 4 G1 images, which will be used as out-of-sample test data to evaluate the ability of the model to run on different grades.

Results and Plotting

The following results were collected after training and testing of the model over 100 epochs, and data was collected every 10 epochs to find the optimal training epoch number.